import { useEffect, useState } from "react";
export const useMouse = () => {
  const [x, setX] = useState(0);
  const [y, setY] = useState(0);
  useEffect(() => {
    document.onmousemove = (e) => {
      const { clientX, clientY } = e;
      setX(clientX);
      setY(clientY);
    };
    return () => {
      document.onmousemove = null;
    };
  });
  return {
    x,
    y,
  };
};
